library(earth)

#Read data
data = read.csv('data.csv',sep="\t")
ind = colnames(data)[1]
deps = colnames(data)[-1]
i = 0
models = list()
for (dep in deps){
  i = i + 1
  form = as.formula(paste(dep," ~ ",ind))
  models[i] = earth(form, data=data, minspan=1)
  plot(form, data=data)
}
